﻿using System;
using System.Collections.Generic;
using KKCai.Core;

namespace KKCai.Web
{
    public abstract class BasePage : KKCai.Utils.Web.PageBase
    {
        public abstract string GetTemplatePath();

        public virtual IDictionary<string, object> GetPageData()
        {
            return new VelocityDictionary();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            //具体页面数据
            VelocityDictionary dict = new VelocityDictionary(this.GetPageData());

            //全局数据
            dict.Add("now", DateTime.Now);

            //渲染模板并输出
            Response.Write(VelocityEngineManager.Instance.Merge(this.GetTemplatePath(), dict));
        }
    }
}
